package Exer04_循环;
import java.util.Scanner;
public class _1_4_4_判断是否为素数 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入一个数，判断是否为素数:");
        int num = scanner.nextInt();
        int i;
        for (i = 2; i <= num; i++) {
            if (num % i == 0){
                break;
            }
        }
        if (num == i){
            System.out.println("是素数");
        }else{
            System.out.println("不是素数");
        }
        scanner.close();
    }
}
